package com.changgou.search.listener;


import com.changgou.search.config.RabbitMQConfig;
import com.changgou.search.service.ESMangerService;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

@Component
public class GoodsUpListener {

    @Autowired
    private ESMangerService service;

    @RabbitListener(queues = RabbitMQConfig.SEARCH_ADD_QUEUE)
    public void receiveMessage(String id){

        System.out.println("接收到的上架id是："+id);
        // 从队列中监听到添加的消息

        // 查询skuList，并导入ES
        service.importDataBySpuId(id);


    }

}
